local times = {}

local function timer(name, f)
	local start = os.clock()
	f()
	local stop = os.clock()

	times[name] = (times[name] or 0) + (stop - start)
end

local function show_timers()
	for n,t in pairs(times) do
		print(n .. ": " .. t .. " sec")
	end
end

function draw_test()
	local w, h = 800, 600
	
	flip.video(w, h)

	local img = flip.load_image("../face.png")
	local spr = img:to_sprite()

	local count = 10000000

	timer("c call", function()
		flip.begin_sprites()
		local sprite_centered_rot = flip.sprite_centered

		for i=1,count do
			sprite_centered_rot(spr[1], i, i*5, i*0.0001)
		end
	end)

	timer("lua", function()
		flip.begin_sprites_2()
		local sprite_centered_rot = flip.sprite_centered_2

		for i=1,count do
			sprite_centered_rot(spr, i, i*5, i*0.0001)
		end
	end)

	show_timers()
end